import pandas as pd

import MultiOptionProcessor as mop

if __name__ == '__main__':
    base_data = pd.read_csv('../data/base_data.csv')
    # print(test_data.head())
    # 初始化工具
    processor = mop.MultiOptionProcessor(max_features=3,other_category=True,save_mappings=True,split_str=",",
                                         mapping_dir="../data/feature_mappings")
    # 训练集处理
    processor.fit(base_data,["gender","interests","is_active","skills"])
    trans_data = processor.transform(base_data)

    pd.DataFrame(trans_data).to_csv("../data/trans_data.csv", index=False)

    base_test_data = pd.read_csv('../data/base_test_data.csv')

    test_data = processor.process_test_set(base_test_data)

    pd.DataFrame(test_data).to_csv("../data/test_data.csv", index=False)